﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OL.FrameCore.Application
{
    public class Result<T>
    {
        /// <summary>
        /// 结果状态 1操作正常 0操作失败 -1异常
        /// </summary>
        public int State { get; set; }
        /// <summary>
        /// 结果信息
        /// </summary>
        public string Msg { get; set; }
        /// <summary>
        /// 结果数据
        /// </summary>
        public T Data { get; set; }
    }

    public class Result: Result<object>
    {
    }
    public class SuccessResult<T> : Result<T>
    {
    }
    public class SuccessResult : Result
    {
        public SuccessResult(string msg = "")
        {
            this.State = 1;
            this.Msg = msg;
        }
    }
    public class FailResult : Result
    {
        public FailResult(string msg = "")
        {
            this.State = 0;
            this.Msg = msg;
        }
    }
    public class ErrorResult : Result
    {
        public ErrorResult(string msg = "")
        {
            this.State = -1;
            this.Msg = msg;
        }
    }
}
